home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
138
/
138.xpi
/
chrome
/
stumbleupon.jar
/
content
/
widgets.xml
< prev
Wrap
Extensible Markup Language
|
2009-07-02
|
27KB
|
863 lines
<?xml version="1.0"?>
<!DOCTYPE window [
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" >
%textcontextDTD;
]>
<bindings id="su_bindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="su_toolbarbutton" display="xul:button"
extends="chrome://global/content/bindings/button.xml#button-base">
<resources>
<stylesheet src="chrome://global/skin/toolbarbutton.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|panel|tooltip"/>
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,toolbarmode,buttonstyle,label"/>
<xul:label class="toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=label,accesskey,crop,toolbarmode,buttonstyle"/>
<xul:image class="toolbarbutton-icon" xbl:inherits="validate=validate2,src=image2,toolbarmode=toolbarmode2,buttonstyle=buttonstyle2"/>
</content>
</binding>
<binding id="su_menuitem-iconic" extends="chrome://global/content/bindings/menu.xml#menuitem">
<content>
<xul:hbox class="menu-iconic-left" align="center" pack="end"
xbl:inherits="selected,_moz-menuactive,disabled,checked">
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/>
</xul:hbox>
<xul:spacer width="5px"/>
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop" crop="right"/>
<xul:hbox anonid="accel">
<xul:label class="menu-iconic-accel" xbl:inherits="value=acceltext"/>
</xul:hbox>
</content>
</binding>
<binding id="su_autocomplete"
extends="chrome://global/content/bindings/textbox.xml#textbox">
<resources>
<stylesheet src="chrome://global/skin/autocomplete.css"/>
<stylesheet src="chrome://stumbleupon/skin/widgets.css"/>
</resources>
<content>
<xul:hbox class="autocomplete-textbox-container" flex="1">
<xul:hbox anonid="textbox-input-box"
class="textbox-input-box"
flex="1"
xbl:inherits="tooltiptext=inputtooltiptext,contextitemalabel,contextitemaaccesskey,contextitemachecked,contextitemaoncommand,contextitemblabel,contextitembaccesskey,contextitembchecked,contextitemboncommand,contextitemclabel,contextitemcaccesskey,contextitemcchecked,contextitemconcommand">
<html:input anonid="input"
class="textbox-input"
flex="1"
allowevents="true"
xbl:inherits="tooltiptext=inputtooltiptext,onfocus,onblur,value,type,maxlength,disabled,size,readonly,userAction"/>
</xul:hbox>
</xul:hbox>
<xul:dropmarker anonid="dropmarker"
class="autocomplete-history-dropmarker"
allowevents="true"/>
<xul:popupset anonid="popupset"/>
</content>
<implementation implements="nsIAccessibleProvider, nsIDOMXULMenuListElement">
<constructor><![CDATA[
var dropmarker = document.getAnonymousElementByAttribute(this, "anonid", "dropmarker");
dropmarker.owner = this;
// This sets the height of the searchbox. This method allows us to remove the
// margin from the text field so that themes that expect no margin don't shift the
// text field down and cut off lower portions of characters in the field.
if (navigator.platform.toLowerCase().indexOf("mac") != -1)
{
dropmarker.style.height = "14px";
}
else
{
dropmarker.style.height = "20px";
}
this.resultsIndex = -1;
this.prevTimeStamp = 0;
]]></constructor>
<field name="mInputElt">
document.getAnonymousElementByAttribute(this, "anonid", "input");
</field>
<!-- =================== nsIAccessibleProvider =================== -->
<property name="accessible">
<getter><![CDATA[
// expose as a combobox
var accService = Components.classes["@mozilla.org/accessibilityService;1"].
getService(Components.interfaces.nsIAccessibilityService);
return accService.createXULComboboxAccessible(this);
]]></getter>
</property>
<!-- =================== nsIDOMXULMenuListElement =================== -->
<property name="editable" readonly="true"
onget="return true;" />
<property name="crop"
onset="this.setAttribute('crop',val); return val;"
onget="return this.getAttribute('crop');"/>
<property name="label" readonly="true" onget="return this.mInputElt.value;"/>
<property name="open"
onget="return this.getAttribute('open') == 'true';">
<setter><![CDATA[
if (val)
{
this.setAttribute("open", "true");
this.showResultsPopup();
}
else
{
this.removeAttribute("open");
this.closePopup();
}
]]></setter>
</property>
<!-- =================== PUBLIC MEMBERS =================== -->
<property name="value"
onget="return this.mInputElt.value;">
<setter><![CDATA[
this.mInputElt.value = val;
this.mKeyedValue = val;
// var evt = document.createEvent("UIEvents");
// evt.initUIEvent("input", true, false, window, 0);
// this.mIgnoreInput = true;
// this.dispatchEvent(evt);
// this.mIgnoreInput = false;
var event = document.createEvent('Events');
event.initEvent('ValueChange', true, true);
this.mInputElt.dispatchEvent(event);
return val;
]]></setter>
</property>
<field name="popup"><![CDATA[
var popup = null;
var popupId = this.getAttribute("autocompletepopup");
if (popupId)
popup = document.getElementById(popupId);
if (!popup) {
popup = document.createElement("popup");
popup.setAttribute("hidden", "true");
var popupset = document.getAnonymousElementByAttribute(this, "anonid", "popupset");
popupset.appendChild(popup);
}
popup.owner = this;
popup
]]></field>
<property name="autocompleteDatasource"
onset="this.mDatasource = val;"
onget="return this.mDatasource;"/>
<property name="reflectPopupLabel"
onset="this.setAttribute('reflectpopuplabel', val); return val;"
onget="return this.getAttribute('reflectpopuplabel') == 'true';"/>
<property name="contextItemALabel"
onset="this.setAttribute('contextitemalabel', val); return val;"
onget="return this.getAttribute('contextitemalabel');"/>
<property name="contextItemAAccesskey"
onset="this.setAttribute('contextitemaaccesskey', val); return val;"
onget="return this.getAttribute('contextitemaaccesskey');"/>
<property name="contextItemAChecked"
onset="this.setAttribute('contextitemachecked', val); return val;"
onget="return this.getAttribute('contextitemachecked') == 'true';"/>
<property name="contextItemACommand"
onset="this.setAttribute('contextitemacommand', val); return val;"
onget="return this.getAttribute('contextitemacommand');"/>
<property name="contextItemBLabel"
onset="this.setAttribute('contextitemblabel', val); return val;"
onget="return this.getAttribute('contextitemblabel');"/>
<property name="contextItemBAccesskey"
onset="this.setAttribute('contextitembaccesskey', val); return val;"
onget="return this.getAttribute('contextitembaccesskey');"/>
<property name="contextItemBChecked"
onset="this.setAttribute('contextitembchecked', val); return val;"
onget="return this.getAttribute('contextitembchecked') == 'true';"/>
<property name="contextItemBCommand"
onset="this.setAttribute('contextitembcommand', val); return val;"
onget="return this.getAttribute('contextitembcommand');"/>
<property name="contextItemCLabel"
onset="this.setAttribute('contextitemclabel', val); return val;"
onget="return this.getAttribute('contextitemclabel');"/>
<property name="contextItemCAccesskey"
onset="this.setAttribute('contextitemcaccesskey', val); return val;"
onget="return this.getAttribute('contextitemcaccesskey');"/>
<property name="contextItemCChecked"
onset="this.setAttribute('contextitemcchecked', val); return val;"
onget="return this.getAttribute('contextitemcchecked') == 'true';"/>
<property name="contextItemCCommand"
onset="this.setAttribute('contextitemccommand', val); return val;"
onget="return this.getAttribute('contextitemccommand');"/>
<method name="onTextReverted">
<body><![CDATA[
return this.fireEvent("textreverted");
]]></body>
</method>
<method name="onTextEntered">
<parameter name="evt"/>
<body><![CDATA[
return this.fireEvent("textentered", evt);
]]></body>
</method>
<!--
<method name="onPageNavigationKey">
<parameter name="evt"/>
<body><![CDATA[
return this.fireEvent("pagenavigationkey", evt);
]]></body>
</method>
-->
<!-- maximum number of rows to display at a time -->
<property name="maxRows"
onset="this.setAttribute('maxrows', val); return val;"
onget="return parseInt(this.getAttribute('maxrows')) || 0;"/>
<property name="selectionStart"
onget="return this.mInputElt.selectionStart;"/>
<property name="selectionEnd"
onget="return this.mInputElt.selectionEnd;"/>
<method name="selectTextRange">
<parameter name="aStartIndex"/>
<parameter name="aEndIndex"/>
<body><![CDATA[
this.mInputElt.setSelectionRange(aStartIndex, aEndIndex);
]]></body>
</method>
<!-- ::::::::::::: child event handling ::::::::::::: -->
<method name="handlePopupShowing">
<body><![CDATA[
this.setAttribute("open", "true");
document.getAnonymousElementByAttribute(this, "anonid", "dropmarker").setAttribute("open", "true");
]]></body>
</method>
<method name="handlePopupHiding">
<body><![CDATA[
setTimeout(this.clearOpenProperty, 0, this);
document.getAnonymousElementByAttribute(this, "anonid", "dropmarker").setAttribute("open", "false");
this.resultsIndex = -1;
]]></body>
</method>
<method name="handlePopupCommand">
<parameter name="evt"/>
<body><![CDATA[
this.value = evt.target.label;
]]></body>
</method>
<method name="handleDropmarkerMousedown">
<body><![CDATA[
this.toggleResultsPopup();
]]></body>
</method>
<method name="clearOpenProperty">
<parameter name="searchbox"/>
<body><![CDATA[
searchbox.setAttribute("open", "false");
]]></body>
</method>
<!-- =================== PRIVATE MEMBERS =================== -->
<!-- ::::::::::::: event dispatching ::::::::::::: -->
<method name="fireEvent">
<parameter name="aEventType"/>
<body><![CDATA[
var cancel = false;
// handle any xml attribute event handlers
var handler = this.getAttribute("on" + aEventType);
if (handler) {
var fn = new Function("eventType", "param", handler);
cancel = fn.apply(this, arguments);
}
return cancel;
]]></body>
</method>
<!-- ::::::::::::: popup open/close ::::::::::::: -->
<method name="openPopup">
<body><![CDATA[
this.popup.showPopup(
this,
-1,
-1,
"popup",
"bottomleft",
"topleft");
]]></body>
</method>
<method name="closePopup">
<body><![CDATA[
this.popup.hidePopup();
]]></body>
</method>
<method name="showResultsPopup">
<body><![CDATA[
while (this.popup.hasChildNodes())
this.popup.removeChild(this.popup.lastChild);
// If building the results list ever becomes an
// extremely lengthy operation, we can change 'results'
// to an enumerator and build the list incrementally.
var results = this.mDatasource.getResults();
if (results.length > 0)
{
for (var i = 0; (i < results.length) && (i < this.maxRows); i++)
{
var item = document.createElement("menuitem");
if (navigator.platform.toLowerCase().indexOf("mac") != -1)
item.setAttribute("class", "su_macpopup");
for (var j in results[i])
{
if (this.isPropertyGarbage(results[i], j)) continue;
item.setAttribute(j, results[i][j]);
}
this.popup.appendChild(item);
}
this.openPopup();
}
else
{
this.closePopup();
}
]]></body>
</method>
<method name="toggleResultsPopup">
<body><![CDATA[
if (this.open)
this.closePopup();
else
this.showResultsPopup();
]]></body>
</method>
<method name="dd">
<parameter name="val"/>
<body><![CDATA[
Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.logStringMessage("" + val);
]]></body>
</method>
<method name="dumpObject">
<parameter name="o"/>
<body><![CDATA[
var str = "";
var p;
for (p in o)
{
try {
str += "[" + p + "]\n" + o[p] + "\n\n";
} catch (e) {
str += "[" + p + "] ERROR\n" + e + "\n\n";
}
}
Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService)
.logStringMessage("###\n" + str);
]]></body>
</method>
<!-- ::::::::::::: key navigation ::::::::::::: -->
<method name="handleKeydown">
<parameter name="evt"/>
<body><![CDATA[
var cancel;
if (evt.timeStamp == this.prevTimeStamp)
return true;
this.prevTimeStamp = evt.timeStamp;
if (((evt.keyCode == KeyEvent.DOM_VK_TAB) && (this.open)) ||
((evt.keyCode == KeyEvent.DOM_VK_RETURN) && (this.open)))
{
evt.stopPropagation();
evt.preventDefault();
return false;
}
return true;
]]></body>
</method>
<method name="handleKeyup">
<parameter name="evt"/>
<body><![CDATA[
if (evt.timeStamp == this.prevTimeStamp)
return true;
this.prevTimeStamp = evt.timeStamp;
/*
if ((evt.ctrlKey || evt.metaKey) &&
((evt.keyCode == KeyEvent.DOM_VK_UP) ||
(evt.keyCode == KeyEvent.DOM_VK_DOWN) ||
(evt.keyCode == KeyEvent.DOM_VK_PAGE_UP) ||
(evt.keyCode == KeyEvent.DOM_VK_PAGE_DOWN)))
{
this.onPageNavigationKey(evt);
return true;
}
*/
if ((evt.keyCode == KeyEvent.DOM_VK_UP)
|| ((evt.keyCode == KeyEvent.DOM_VK_TAB) && evt.shiftKey))
{
if (this.open)
{
this.resultsIndex--;
if (this.resultsIndex == -2)
{
this.resultsIndex = this.popup.childNodes.length - 1;
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
else if (this.resultsIndex == -1)
{
this.popup.childNodes[this.resultsIndex + 1].removeAttribute('_moz-menuactive');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.mKeyedValue;
}
}
else
{
if ((this.resultsIndex + 1) < this.popup.childNodes.length)
{
this.popup.childNodes[this.resultsIndex + 1].removeAttribute('_moz-menuactive');
}
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
}
else if (evt.keyCode != KeyEvent.DOM_VK_TAB)
{
this.showResultsPopup();
if (this.reflectPopupLabel)
{
this.mKeyedValue = this.mInputElt.value;
}
}
}
else if ((evt.keyCode == KeyEvent.DOM_VK_DOWN)
|| ((evt.keyCode == KeyEvent.DOM_VK_TAB) && (! evt.shiftKey)))
{
if (this.open)
{
this.resultsIndex++;
if (this.resultsIndex == this.popup.childNodes.length + 1)
{
this.resultsIndex = 0;
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
else if (this.resultsIndex == this.popup.childNodes.length)
{
this.popup.childNodes[this.resultsIndex - 1].removeAttribute('_moz-menuactive');
this.resultsIndex = -1;
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.mKeyedValue;
}
}
else
{
if ((this.resultsIndex - 1) >= 0)
{
this.popup.childNodes[this.resultsIndex - 1].removeAttribute('_moz-menuactive');
}
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
}
else if (evt.keyCode != KeyEvent.DOM_VK_TAB)
{
this.showResultsPopup();
if (this.reflectPopupLabel)
{
this.mKeyedValue = this.mInputElt.value;
}
}
}
else if ((evt.keyCode == KeyEvent.DOM_VK_LEFT)
|| (evt.keyCode == KeyEvent.DOM_VK_RIGHT)
|| (evt.keyCode == KeyEvent.DOM_VK_HOME)
|| (evt.keyCode == KeyEvent.DOM_VK_END))
{
if (this.open)
{
this.closePopup();
}
}
else if (evt.keyCode == KeyEvent.DOM_VK_PAGE_UP)
{
if (this.open)
{
if (this.resultsIndex == -1)
{
this.resultsIndex = this.popup.childNodes.length - 1;
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
else if (this.resultsIndex == this.popup.childNodes.length -1)
{
this.popup.childNodes[this.resultsIndex].removeAttribute('_moz-menuactive');
this.resultsIndex = 0;
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
else if (this.resultsIndex == 0)
{
this.popup.childNodes[this.resultsIndex].removeAttribute('_moz-menuactive');
this.resultsIndex = -1;
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.mKeyedValue;
}
}
}
else
{
this.showResultsPopup();
if (this.reflectPopupLabel)
{
this.mKeyedValue = this.mInputElt.value;
}
}
}
else if (evt.keyCode == KeyEvent.DOM_VK_PAGE_DOWN)
{
if (this.open)
{
if (this.resultsIndex == -1)
{
this.resultsIndex = 0;
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
else if (this.resultsIndex == this.popup.childNodes.length -1)
{
this.popup.childNodes[this.resultsIndex].removeAttribute('_moz-menuactive');
this.resultsIndex = -1;
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.mKeyedValue;
}
}
else if (this.resultsIndex == 0)
{
this.popup.childNodes[this.resultsIndex].removeAttribute('_moz-menuactive');
this.resultsIndex = this.popup.childNodes.length - 1;
this.popup.childNodes[this.resultsIndex].setAttribute('_moz-menuactive', 'true');
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
}
}
}
else
{
this.showResultsPopup();
if (this.reflectPopupLabel)
{
this.mKeyedValue = this.mInputElt.value;
}
}
}
else if (evt.keyCode == KeyEvent.DOM_VK_ESCAPE)
{
if (this.open)
{
this.closePopup();
if (this.reflectPopupLabel)
{
this.mInputElt.value = this.mKeyedValue;
}
}
else
{
this.onTextReverted();
}
}
// For now, I'm assuming that OS9 and OSX both have this weird keyCode
// 77 behavior for ctrl-return. -- JW
else if (((navigator.platform.toLowerCase().indexOf("mac") == -1) &&
(evt.keyCode == KeyEvent.DOM_VK_RETURN)) ||
((navigator.platform.toLowerCase().indexOf("mac") != -1) &&
((evt.ctrlKey && (evt.keyCode == 77)) || ((! evt.ctrlKey) &&
(evt.keyCode == KeyEvent.DOM_VK_RETURN)))))
{
if((this.open) && (this.resultsIndex == -1))
{
this.closePopup();
this.onTextEntered(evt);
}
else if ((this.open) && (this.resultsIndex != -1))
{
this.mInputElt.value = this.popup.childNodes[this.resultsIndex].label;
this.popup.hidePopup();
if (evt.ctrlKey || evt.metaKey)
{
this.onTextEntered(evt);
}
}
else
{
this.onTextEntered(evt);
}
}
else if (evt.keyCode == KeyEvent.DOM_VK_F4)
{
this.toggleResultsPopup();
}
else
{
if (this.mInputElt.value != this.mKeyedValue)
{
this.mKeyedValue = this.mInputElt.value;
if (this.mKeyedValue == "")
{
this.closePopup();
}
else
{
this.showResultsPopup();
}
}
}
return true;
]]></body>
</method>
<!-- ::::::::::::: utilities ::::::::::::: -->
<method name="isPropertyGarbage">
<parameter name="obj"/>
<parameter name="prop"/>
<body><![CDATA[
var garbage_flag = false;
switch (prop.toLowerCase())
{
case "tojsonstring":
case "toxmlrpcparam":
garbage_flag = true;
break;
default:
if ((typeof (obj[prop])) == "function")
{
garbage_flag = true;
}
break;
}
return garbage_flag;
]]></body>
</method>
</implementation>
<handlers>
<handler event="keydown" phase="capturing"
action="return this.handleKeydown(event);"/>
<handler event="keyup" phase="capturing"
action="return this.handleKeyup(event);"/>
</handlers>
</binding>
<binding id="su_autocompletepopup" extends="chrome://global/content/bindings/popup.xml#popup">
<implementation>
<constructor><![CDATA[
this.setAttribute("ignorekeys", "true");
]]></constructor>
</implementation>
<handlers>
<handler event="popupshowing"><![CDATA[
this.owner.handlePopupShowing();
]]></handler>
<handler event="popuphiding"><![CDATA[
this.owner.handlePopupHiding();
]]></handler>
<handler event="command"><![CDATA[
this.owner.handlePopupCommand(event);
]]></handler>
</handlers>
</binding>
<binding id="su_autocompletedropmarker" extends="xul:button">
<content>
<xul:image/>
</content>
<implementation implements="nsIAccessibleProvider">
<property name="accessible">
<getter><![CDATA[
var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService);
return accService.createXULDropmarkerAccessible(this);
]]></getter>
</property>
</implementation>
<handlers>
<handler event="mousedown"
button="0"
action="return this.parentNode.handleDropmarkerMousedown(event)"/>
</handlers>
</binding>
<binding id="su_autocompletecontext">
<content context="_child">
<children/>
<xul:menupopup anonid="input-box-contextmenu"
onpopupshowing="if (document.commandDispatcher.focusedElement != this.parentNode.firstChild) { this.parentNode.firstChild.focus(); }; this.parentNode.initPopupItems(this);"
oncommand="var command = event.originalTarget.getAttribute('cmd'); if (command) { this.parentNode.doCommand(); event.preventBubble(); }">
<xul:menuitem label="&undoCmd.label;" accesskey="&undoCmd.accesskey;" cmd="cmd_undo"/>
<xul:menuseparator/>
<xul:menuitem label="&cutCmd.label;" accesskey="&cutCmd.accesskey;" cmd="cmd_cut"/>
<xul:menuitem label="©Cmd.label;" accesskey="©Cmd.accesskey;" cmd="cmd_copy"/>
<xul:menuitem label="&pasteCmd.label;" accesskey="&pasteCmd.accesskey;" cmd="cmd_paste"/>
<xul:menuitem label="&deleteCmd.label;" accesskey="&deleteCmd.accesskey;" cmd="cmd_delete"/>
<xul:menuseparator/>
<xul:menuitem label="&selectAllCmd.label;" accesskey="&selectAllCmd.accesskey;" cmd="cmd_selectAll"/>
<xul:menuseparator anonid="contextitemseparator"/>
<xul:menuitem anonid="contextitema"
type="checkbox"
checked="true"
xbl:inherits="label=contextitemalabel,accesskey=contextitemaaccesskey,checked=contextitemachecked,oncommand=contextitemaoncommand"/>
<xul:menuitem anonid="contextitemb"
type="checkbox"
checked="true"
xbl:inherits="label=contextitemblabel,accesskey=contextitembaccesskey,checked=contextitembchecked,oncommand=contextitemboncommand"/>
<xul:menuitem anonid="contextitemc"
type="checkbox"
checked="true"
xbl:inherits="label=contextitemclabel,accesskey=contextitemcaccesskey,checked=contextitemcchecked,oncommand=contextitemconcommand"/>
</xul:menupopup>
</content>
<implementation>
<method name="initPopupItems">
<parameter name="popupNode"/>
<body>
<![CDATA[
var children = popupNode.childNodes;
for (var i = 0; i < children.length; i++)
{
var command = children[i].getAttribute("cmd");
if (command)
{
var controller = document.commandDispatcher.getControllerForCommand(command);
var enabled = controller.isCommandEnabled(command);
if (enabled)
children[i].removeAttribute("disabled");
else
children[i].setAttribute("disabled", "true");
}
}
]]>
</body>
</method>
<method name="doCommand">
<parameter name="command"/>
<body>
<![CDATA[
var controller = document.commandDispatcher.getControllerForCommand(command);
controller.doCommand(command);
]]>
</body>
</method>
</implementation>
</binding>
</bindings>